// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   Anytable1BO.java

package com.vandagroup.common.util.anytable1;

import com.vandagroup.common.bo.ESSBO;
import com.vandagroup.common.util.Result;
import com.vandagroup.common.util.SQLUtility;
import java.sql.SQLException;

// Referenced classes of package com.vandagroup.common.util.anytable1:
//            Anytable1PO, Anytable1FormBean

public class Anytable1BO extends ESSBO
{

    Anytable1PO po;

    public Anytable1BO()
    {
        po = new Anytable1PO();
    }

    public Result query(int pageNO, Anytable1FormBean bean)
        throws SQLException, Exception
    {
        String whereClause = "";
        po.setTableName(bean.getTablename());
        po.setColumnNames(bean.getDispfield());
        String dispfields[] = bean.getDispfield().split(",");
        String alltype[] = bean.getAlltype().split(",");
        String arg[] = bean.getArg();
        for(int i = 0; i < dispfields.length; i++)
            if(alltype[i].equals("String") || alltype[i].equals("Date"))
                whereClause = SQLUtility.addLikeClause(whereClause, dispfields[i], arg[i]);
            else
                whereClause = SQLUtility.addWhereClause(whereClause, dispfields[i], arg[i], false);

        po.setWhereClause(whereClause);
        if(bean.getDbName() != null)
            po.setDbName(bean.getDbName());
        po.setResultPage(20, pageNO);
        Result result = po.queryResult();
        return result;
    }
}
